<template>
  <el-drawer
    title="订单详情"
    :visible.sync="showOrder"
    size="1000px"
    :wrapper-closable="!modalDialog"
  >
    <div class="property-title">订单信息</div>
    <div class="df_ac">
      <div>
        <span class="key">订单编号：</span>
        <span class="value">{{ detail.orderId }}</span>
      </div>
      <div>
        <span class="key">订单状态：</span>
        <span class="value"> {{ detail.orderStatus }}</span>
      </div>
      <div>
        <span class="key">创建时间：</span>
        <span class="value">{{ detail.orderTime }}</span>
      </div>
      <div>
        <span class="key">订单来源：</span>
        <span class="value">{{ detail.fromType == '01'?'小程序': '场馆pc端' }}</span>
      </div>
      <div v-if="detail.payTime">
        <span class="key">支付时间：</span>
        <span class="value">{{ detail.payTime || '~' }}</span>
      </div>
      <div v-if="detail.payMethod">
        <span class="key">支付方式：</span>
        <span class="value">{{ detail.payMethod || '~' }}</span>
      </div>
      <div v-if="detail.mixedPayMethod" class="item">
        <span class="key">混合支付方式：</span>
        <span class="value">{{ detail.mixedPayMethod || '-' }}</span>
      </div>
      <div v-if="detail.mixedPayMoney" class="item">
        <span class="key">混合支付金额：</span>
        <span class="value">{{ detail.mixedPayMoney || '-' }}</span>
      </div>
      <div v-if="detail.cardPayMoney" class="item">
        <span class="key">混合支付会员卡金额：</span>
        <span class="value">{{ detail.cardPayMoney || '-' }}</span>
      </div>
      <div v-if="detail.refundPrice || detail.refundPrice === 0">
        <span class="key">退款金额：</span>
        <span class="value">{{ detail.refundPrice }}</span>
      </div>
      <div>
        <span class="key">操作员：</span>
        <span class="value">{{ detail.createUser || '~' }}</span>
      </div>
      <div>
        <span class="key">备注：</span>
        <span class="value">{{ detail.remake || '~' }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">开票情况</div>
    <div class="df_ac">
      <div>
        <span class="key">开票状态：</span>
        <span class="value">{{ detail.invoiceStatus== '1'?"已开":"未开取" }}</span>
      </div>
      <div>
        <span class="key">开票时间：</span>
        <span class="value">{{ detail.invoiceTime || "~" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">会员信息</div>
    <div class="df_ac">
      <div>
        <span class="key">姓名：</span>
        <span class="value">{{ detail.memberName }}</span>
      </div>
      <div>
        <span class="key">联系电话：</span>
        <span class="value">{{ detail.memberPhone || "~" }}</span>
      </div>
      <div>
        <span class="key">会员卡号：</span>
        <span class="value">{{ detail.memberId || "~" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">商品信息</div>
    <el-table
      ref="multipleTable"
      :data="detail.orderDetailList"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        label="伴游卡名称"
        prop="escortName"
        show-overflow-tooltip
        min-width="120"
      />

      <el-table-column
        align="center"
        label="关联产品"
        show-overflow-tooltip
        prop="objName"
        min-width="120"
      />
      <el-table-column
        label="订单金额"
        prop="price"
        min-width="100"
        show-overflow-tooltip
        align="center"
      />
      <el-table-column
        label="会员折扣"
        prop="memberPrice"
        show-overflow-tooltip
        min-width="100"
        align="center"
      />
      <el-table-column
        label="退款金额"
        prop="refundPrice"
        show-overflow-tooltip
        min-width="100"
        align="center"
      />
      <el-table-column
        label="状态"
        prop="payStatus"
        show-overflow-tooltip
        min-width="80"
        align="center"
      />
    </el-table>
    <div v-if="detail.detailMoneyRespParam" class="bottom_wrap">
      <div class="line">
        <span>订单商品金额：</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.orderPrice || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.memberDiscount" class="line">
        <span>{{ detail.payMethod == '专项卡支付' ? '专项卡折扣：' : '会员折扣：' }}</span>
        <span v-if="detail.detailMoneyRespParam.memberDiscount">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.memberDiscount || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.marketingPolicy" class="line">
        <span>营销政策：</span>
        <span v-if="detail.detailMoneyRespParam.marketingPolicy">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.marketingPolicy || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.groupBuyCoupon" class="line">
        <span>团购券：</span>
        <span v-if="detail.detailMoneyRespParam.groupBuyCoupon">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.groupBuyCoupon || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.discountCoupon" class="line">
        <span>优惠券：</span>
        <span v-if="detail.detailMoneyRespParam.discountCoupon">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.discountCoupon || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.integral" class="line">
        <span>积分抵扣：</span>
        <span v-if="detail.detailMoneyRespParam.integral">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.integral || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.getPrice || detail.detailMoneyRespParam.getPrice === 0" class="line secondColor">
        <span>实收款：</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.getPrice || 0 }} </span>
        <span>元{{ detail.mealsMemberId?'(预定次卡)':'' }}</span>
      </div>
    </div>
  </el-drawer>
  <!--</div> -->
</template>

<script>
import { escortOrderDetail } from '@/api'
import store from '@/store'
export default {
  name: 'OrderDetail',
  data() {
    return {
      detail: {},
      modalDialog: store.getters.dialog,
      showOrder: false // 弹窗
    }
  },
  methods: {
    goBack() {
      this.$router.replace('/ticket/ticketOrder')
    },
    getOrderDetail(orderId) {
      escortOrderDetail({ param: { orderId }}).then((res) => {
        if (res.errorCode === '000000') {
          this.showOrder = true
          this.detail = res.record
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
  color: #666666;
  display: inline-block;
  // width: 90px;
  // text-align: right;
}
.value {
  color: #222;
}
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
